<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8" />
  <title>Aloha Editor</title>
  <meta name="description" content="The world's most advanced browser HTML5 based WYSIWYG editor lets you experience a whole new way of editing." />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <link rel="stylesheet" href="css/api.css" />
  <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.js"></script>
  <script src="js/jquery-bbq.js"></script>
  <script src="js/api.js"></script>
  <script src="js/lib/modernizr-1.7.min.js"></script>
  <!--[if lt IE 9]>
  <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
  <![endif]-->
</head>

  <body id="docs">
<!-- ============================== header ================================= -->
    <!-- begin static/header.html -->
      <header role="banner">
    <div class="container">
      <h1 id="logo">
        <a href="http://aloha-editor.org"><img src="img/logo.png" alt="Aloha Editor" /></a>
        </h1>

      <nav role="navigation">
        <ul>
          <li><a href="http://aloha-editor.org/about.php">About</a></li>
          <li><a href="#">Guides</a></li>
          <li class="active"><a href="http://aloha-editor.org/api" >API Docs</a></li>
          <li><a href="http://getsatisfaction.com/aloha_editor">Forum</a></li>
        </ul>
      </nav>
    </div>
  </header>
  


    <!-- end static/header.html -->

<!-- ============================== classes index ============================ -->

    <section id="list">
      <header>
        <form action="#" role="search">
          <input type="text" />
          <a href="#" class="search-reset"></a>
        </form>
      </header>
      <div>
        <span class="odd active"><a href="/">API Documentation Index</a></span>
	
	<span class='even' global><a href="../symbols/_global_.html">_global_</a></span>
	
	<span class='odd'><a href="../symbols/Aloha.Editable.html">Aloha.Editable</a></span>
	
	<span class='even'><a href="../symbols/Aloha.Message.html">Aloha.Message</a></span>
	
	<span class='odd'><a href="../symbols/Aloha.RepositoryDocument.html">Aloha.RepositoryDocument</a></span>
	
	<span class='even'><a href="../symbols/Aloha.RepositoryFolder.html">Aloha.RepositoryFolder</a></span>
	
	<span class='odd'><a href="../symbols/Aloha.RepositoryManager.html">Aloha.RepositoryManager</a></span>
	
	<span class='even'><a href="../symbols/Aloha.ui.Button.html">Aloha.ui.Button</a></span>
	
	<span class='odd'><a href="../symbols/Aloha.ui.MultiSplitButton.html">Aloha.ui.MultiSplitButton</a></span>
	
	<span class='even'><a href="../symbols/Array.html">Array</a></span>
	
	<span class='odd'><a href="../symbols/block.html">block</a></span>
	
	<span class='even'><a href="../symbols/block.block.html">block.block</a></span>
	
	<span class='odd'><a href="../symbols/block.block.AbstractBlock.html">block.block.AbstractBlock</a></span>
	
	<span class='even'><a href="../symbols/block.block.DebugBlock.html">block.block.DebugBlock</a></span>
	
	<span class='odd'><a href="../symbols/block.block.DefaultBlock.html">block.block.DefaultBlock</a></span>
	
	<span class='even'><a href="../symbols/block.BlockContentHandler.html">block.BlockContentHandler</a></span>
	
	<span class='odd'><a href="../symbols/block.blockmanager.html">block.blockmanager</a></span>
	
	<span class='even'><a href="../symbols/block.editor.html">block.editor</a></span>
	
	<span class='odd'><a href="../symbols/block.editor.AbstractEditor.html">block.editor.AbstractEditor</a></span>
	
	<span class='even'><a href="../symbols/block.editor.AbstractFormElementEditor.html">block.editor.AbstractFormElementEditor</a></span>
	
	<span class='odd'><a href="../symbols/block.editor.EmailEditor.html">block.editor.EmailEditor</a></span>
	
	<span class='even'><a href="../symbols/block.editor.NumberEditor.html">block.editor.NumberEditor</a></span>
	
	<span class='odd'><a href="../symbols/block.editor.StringEditor.html">block.editor.StringEditor</a></span>
	
	<span class='even'><a href="../symbols/block.editor.UrlEditor.html">block.editor.UrlEditor</a></span>
	
	<span class='odd'><a href="../symbols/block.editormanager.html">block.editormanager</a></span>
	
	<span class='even'><a href="../symbols/block.sidebarattributeeditor.html">block.sidebarattributeeditor</a></span>
	
	<span class='odd'><a href="../symbols/Boolean.html">Boolean</a></span>
	
	<span class='even'><a href="../symbols/contenthandler.html">contenthandler</a></span>
	
	<span class='odd'><a href="../symbols/Date.html">Date</a></span>
	
	<span class='even'><a href="../symbols/diff_match_patch.html">diff_match_patch</a></span>
	
	<span class='odd'><a href="../symbols/Ext.html">Ext</a></span>
	
	<span class='even'><a href="../symbols/Ext.DomQuery.html">Ext.DomQuery</a></span>
	
	<span class='odd'><a href="../symbols/Ext.TaskMgr.html">Ext.TaskMgr</a></span>
	
	<span class='even'><a href="../symbols/Ext.util.TaskRunner.html">Ext.util.TaskRunner</a></span>
	
	<span class='odd'><a href="../symbols/Function.html">Function</a></span>
	
	<span class='even'><a href="../symbols/GENTICS.Utils.RangeObject.html">GENTICS.Utils.RangeObject</a></span>
	
	<span class='odd'><a href="../symbols/GENTICS.Utils.RangeTree.html">GENTICS.Utils.RangeTree</a></span>
	
	<span class='even'><a href="../symbols/jQuery.html">jQuery</a></span>
	
	<span class='odd'><a href="../symbols/jQuery.fn.html">jQuery.fn</a></span>
	
	<span class='even'><a href="../symbols/patch_obj.html">patch_obj</a></span>
	
	<span class='odd'><a href="../symbols/rangy-Module.html">rangy-Module</a></span>
	
	<span class='even'><a href="../symbols/String.html">String</a></span>
	
	<span class='odd'><a href="../symbols/Ui.AttributeField.html">Ui.AttributeField</a></span>
	

      </div>
    </section>
    <footer>
      <a href="https://github.com/alohaeditor/Aloha-Editor/issues" class="button secondary">REPORT AN ISSUE</a>
    </footer>

    <div role="main">
      <section id="documentation">
<!-- ============================== class title ============================ -->
        <h1 class="classTitle">
          
          Class: Ext.util.TaskRunner
        </h1>

<!-- ============================== class summary ========================== -->
        <p class="description">
          <span class="extends">
          
          </span>

          <p><code class='syntax js'><span class="class">Ext</span>.<span class="variable">util</span>.<span class="class">TaskRunner</span></code>
Provides the ability to execute one or more arbitrary tasks in a multithreaded
manner.  Generally, you can use the singleton {@link <code class='syntax js'><span class="class">Ext</span>.<span class="class">TaskMgr</span></code>} instead, but
if needed, you can create separate instances of TaskRunner.  Any number of
separate tasks can be started at any time and will run independently of each
other. Example usage:</p>

<pre><code class='syntax js'><span class="comment">// Start a simple clock task that updates a div once per second</span>
<span class="keyword">var</span> <span class="variable">updateClock</span> = <span class="keyword">function</span>(){
<span class="class">Ext</span>.<span class="variable">fly</span>(<span class="string">'clock'</span>).<span class="variable">update</span>(<span class="keyword">new</span> <span class="class">Date</span>().<span class="variable">format</span>(<span class="string">'g:i:s A'</span>));
} 
<span class="keyword">var</span> <span class="variable">task</span> = {
<span class="variable">run</span>: <span class="variable">updateClock</span>,
<span class="variable">interval</span>: <span class="number integer">1000</span> <span class="comment">//1 second</span>
}
<span class="keyword">var</span> <span class="variable">runner</span> = <span class="keyword">new</span> <span class="class">Ext</span>.<span class="variable">util</span>.<span class="class">TaskRunner</span>();
<span class="variable">runner</span>.<span class="variable">start</span>(<span class="variable">task</span>);

<span class="comment">// equivalent using TaskMgr</span>
<span class="class">Ext</span>.<span class="class">TaskMgr</span>.<span class="variable">start</span>({
<span class="variable">run</span>: <span class="variable">updateClock</span>,
<span class="variable">interval</span>: <span class="number integer">1000</span>
});
</code></pre>

<p>See the {@link #start} method for details about how to configure a task object.</p>

<p>Also see {@link <code class='syntax js'><span class="class">Ext</span>.<span class="variable">util</span>.<span class="class">DelayedTask</span></code>}.</p>

          
            <span class="definedin">Defined in: <a href="../symbols/src/_Users_rene_evo42_app_aloha_Aloha-Editor_src_lib_aloha.js.html">aloha.js</a>.</span>
          
        </p>


<!-- ============================== properties summary ===================== -->
      
      




<!-- ============================== methods summary ======================== -->
      
      
        
        
      
        
        
          <h2>Instance Methods</h2>
          <ul class="methods">
          
            <li class="fixedFont"><a href="../symbols/Ext.util.TaskRunner.html#start">start</a></li>
          
            <li class="fixedFont"><a href="../symbols/Ext.util.TaskRunner.html#stop">stop</a></li>
          
            <li class="fixedFont"><a href="../symbols/Ext.util.TaskRunner.html#stopAll">stopAll</a></li>
          
          </ul>
        
      
<!-- ============================== events summary ======================== -->
      



<!-- ============================== field details ========================== -->
      


<!-- ============================== method details ========================= -->
      
        
        
      
        
        
          <h2>Instance Method Detail</h2>
          
            <a name="start"> </a>
            <div class="fixedFont">
              <span class="methodname">start</span>
            </div>
            <div class="description">
              Starts a new task.
              
              
            </div>

            

              
                <dl class="parameters">
                <dt class="heading">Parameters:</dt>
                
                  <dt>
                    <span class="light fixedFont">Object</span> <b>task</b>
                    
                  </dt>
                  <dd><p>A config object that supports the following properties:<ul>
<li><code>run</code> : Function<div class="sub-desc"><p>The function to execute each time the task is invoked. The
function will be called at each interval and passed the <code>args</code> argument if specified, and the
current invocation count if not.</p>
<p>If a particular scope (<code>this</code> reference) is required, be sure to specify it using the <code>scope</code> argument.</p>
<p>Return <code>false</code> from this function to terminate the task.</p></div></li>
<li><code>interval</code> : Number<div class="sub-desc">The frequency in milliseconds with which the task
should be invoked.</div></li>
<li><code>args</code> : Array<div class="sub-desc">(optional) An array of arguments to be passed to the function
specified by <code>run</code>. If not specified, the current invocation count is passed.</div></li>
<li><code>scope</code> : Object<div class="sub-desc">(optional) The scope (<tt>this</tt> reference) in which to execute the
<code>run</code> function. Defaults to the task config object.</div></li>
<li><code>duration</code> : Number<div class="sub-desc">(optional) The length of time in milliseconds to invoke
the task before stopping automatically (defaults to indefinite).</div></li>
<li><code>repeat</code> : Number<div class="sub-desc">(optional) The number of times to invoke the task before
stopping automatically (defaults to indefinite).</div></li>
</ul></p>
<p>Before each invocation, Ext injects the property <code>taskRunCount</code> into the task object so
that calculations based on the repeat count can be performed.</p></dd>
                
                </dl>
              
              
              
              
              
                <dl class="returns">
                <dt class="heading">Returns:</dt>
                
                  <dd><span class="light fixedFont">Object</span> The task</dd>
                
                </dl>
              
              
              

          
            <a name="stop"> </a>
            <div class="fixedFont">
              <span class="methodname">stop</span>
            </div>
            <div class="description">
              Stops an existing running task.
              
              
            </div>

            

              
                <dl class="parameters">
                <dt class="heading">Parameters:</dt>
                
                  <dt>
                    <span class="light fixedFont">Object</span> <b>task</b>
                    
                  </dt>
                  <dd>The task to stop</dd>
                
                </dl>
              
              
              
              
              
                <dl class="returns">
                <dt class="heading">Returns:</dt>
                
                  <dd><span class="light fixedFont">Object</span> The task</dd>
                
                </dl>
              
              
              

          
            <a name="stopAll"> </a>
            <div class="fixedFont">
              <span class="methodname">stopAll</span>
            </div>
            <div class="description">
              Stops all tasks that are currently running.
              
              
            </div>

            

              
              
              
              
              
              
              

          
        
      

<!-- ============================== event details ========================= -->
      



<!-- ============================== footer ================================= -->
        <div class="fineprint" style="clear:both">
          
          Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blank">JsDoc Toolkit</a> 2.4.0 on Wed Nov 30 2011 13:33:45 GMT+0100 (CET)
        </div>
      </section>
    </div>
  </body>
</html>
